package com.zgm.ch04.applicationContext.i18n._9_5_1;

import java.util.Locale;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MessageSourceDemo {

	public static void main(String[] args){
		ApplicationContext ctx = new ClassPathXmlApplicationContext("com/zgm/ch04/applicationContext/i18n/_9_5_1/_9_5_1-context.xml");
		
		Locale english = Locale.ENGLISH;
		Locale china = new Locale("zh", "CN");
		
		System.out.println(ctx.getMessage("msg", null, english));
		System.out.println(ctx.getMessage("msg", null, Locale.UK));
		System.out.println(ctx.getMessage("msg", null, china));
		System.out.println(ctx.getMessage("hello", null, Locale.UK));
		
		System.out.println(ctx.getMessage("nameMsg", new Object[]{"周光明", "周浩", "周成"}, china));
	}
}
